<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<script>
description('Test that document.open() doesn\'t crash when being opened from a frame-less context.');

window.jsTestIsAsync = true;

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
    testRunner.setPopupBlockingEnabled(false);
}

(function() {
    if (location.hash == "#stop")
        return;

    blankWindow = open(location + "#stop");
    blankWindow.onload = function() {
        blankFunc = blankWindow.Function;
        blankWindow.eval("location = 'about:blank'");
        setTimeout(function() {
            blankFunc( "(" + function() { targetWindow = open(); } + ")()")();
            finishJSTest();
        });
    };
})();
</script>
</body>
</html>
